Carbon


MPWaitOnSemaphore

Header: Multiprocessing.h Carbon status: Supported

Waits on a semaphore

OSStatus MPWaitOnSemaphore (
    MPSemaphoreID semaphore, 
    Duration timeout
);
semaphore

The ID of the semaphore you want to wait on.

timeout

The maximum time the function should wait before timing out. See “Timer Duration Constants” for a list of constants you can use to specify the wait interval.

function result

A result code.

DISCUSSION

If the value of the semaphore is greater than zero, the value is decremented and the function returns with noErr. Otherwise, the task is blocked awaiting a signal until the specified timeout is exceeded.

If you call this function from a cooperative task, you should specify only kDurationImmediate for the timeout length; other waits will cause the task to block.

Also see the function MPSignalSemaphore.

VERSION NOTES

Introduced with Multiprocessing Services 1.0.

AVAILABILITY

Supported in Carbon. Available in CarbonLib 1.0 and later when MPLibrary 1.0 or later is installed. Exported by CarbonLib 1.0 and later and by MPLibrary 1.0 and later.


© 2000 Apple Computer, Inc. — (Last Updated 4/6/2000)